<template>
	<view>
		<!-- <topLogo></topLogo> -->
		<view class="toptext">
			<text class="huismalltext">订单状态：</text><text class="redtext" v-if="orderData.status==2">已发货</text><text
				v-else-if="orderData.status==3" class="redtext">已收货</text><text class="redtext" v-else>已付款</text>
		</view>
		<view class="toptext">
			<text class="huismalltext">订单编号：{{orderData.code}}</text>
		</view>
		<view class="toptext huibg shouhuo" v-if="orderData.typeId!=3">
			<view class="huismalltext">
				收货地址：
			</view>
			<view class="shouh3" v-if="orderData.addressName!='undefined'">
				{{orderData.addressName}} {{orderData.addressPhone}}
			</view>
			<view class="shouh4" v-if="orderData.productModel!=1">
				{{orderData.addressAddress}}
			</view>
			<view class="shouh4 shouh5" v-else>
				自提地点：{{orderData.addressAddress}} <button type="primary" size="mini" class="anniu"
					@click="$public.navto('/pages/service/qtAddress',{isqt:1,id:orderData.addressId})">点击查看</button>
			</view>
			<view class="shouh4" v-if="orderData.productModel!=1">
				快递公司：{{orderData.productName}}
			</view>
			<view class="shouh4" v-if="orderData.productModel!=1">
				快递单号：{{orderData.productNum}}
			</view>
		</view>

		<view class="goods-section">
			<!-- 商品列表 -->
			<view class="g-item" v-for="(item,index) in goodList" :key="index">
				<image :src="$public.imgageUrl(item.image)">
				</image>
				<view class="right">
					<view class="title clamp">{{item.title}}</view>
					<view class="spec" v-if="orderData.typeId!=3">商品规格：{{item.attr_val}}</view>
					<view class="price-box">
						<text class="price">￥{{item.money}}<text v-if="orderData.typeId==1">+{{item.price}}积分</text> </text>
						<text class="number">x {{item.num}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="toptext huibg" v-if="orderData.typeId<3">
			备注填写：<text class="redtext">{{orderData.remark}}</text>
		</view>
		<view class="toptext huibg" v-else-if="orderData.typeId==3" style="text-align: center;">
			<image :src="$public.imgageUrl(orderData.productImage)" mode="scaleToFill" class="ewm"></image>
			<view class="redwz">
				到点请出示此卷
			</view>
		</view>
		<view class="toptext felx-box">
			订单金额: <text>￥{{orderData.money}}<text v-if="orderData.typeId==1">+{{orderData.integral}}积分</text></text>
		</view>
		<!-- <view class="toptext">
			总计：<text>￥已发货(含运费)</text>
		</view> -->
		<view class="toptext noline">
			<text class="huismalltext">付款时间：{{orderData.createTime}}</text>
		</view>
		<view class="toptext noline">
			<text class="huismalltext">支付方式：{{orderData.way==0?'积分支付':'微信支付'}}</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				buyValue: {
					productId: 1,
					num: 1,
					model: "1-1",
				},
				desc: '', //备注
				payType: 1, //1微信
				remark: "",
				addressData: {},
				goodList: [],
				total: 0,
				orderData: {}
			}
		},
		onLoad(options) {
			if (options.orderId) {
				this.loadOrder(options.orderId)
			}
			// this.loadOrder(58)
		},
		methods: {
			loadOrder(orderId) {
				this.$public.htmlPost("/api/getOrder", {
					orderId: orderId
				}).then((res) => {
					console.log("订单详情", res)
					this.orderData = res.data.data
					this.goodList = JSON.parse(res.data.data.json)
				})
			},
		}
	}
</script>

<style lang="scss">
	.goods-section {
		margin-top: 16upx;
		background: #fff;
		padding-bottom: 1px;

		.name {
			font-size: 30upx;
			color: $font-color-base;
			margin-left: 24upx;
		}

		.g-item {
			display: flex;
			padding: 20upx 30upx;

			image {
				flex-shrink: 0;
				display: block;
				width: 140upx;
				height: 140upx;
				border-radius: 4upx;
			}


		}

		.right {
			flex: 1;
			padding-left: 24upx;
			overflow: hidden;
		}

		.title {
			font-size: 30upx;
			color: $font-color-dark;
		}

		.spec {
			font-size: 26upx;
			color: $font-color-light;
		}

		.price-box {
			display: flex;
			align-items: center;
			font-size: 32upx;
			color: $font-color-dark;
			padding-top: 10upx;

			.price {
				margin-bottom: 4upx;
			}

			.number {
				font-size: 26upx;
				color: $font-color-base;
				margin-left: 20upx;
			}
		}

		.step-box {
			position: relative;
		}
	}

	.toptext {
		font-size: 24upx;

		border-bottom: 1px solid #eee;
		line-height: 3;
		padding: 0 30upx;
		font-size: 28upx;

		&.felx-box {
			display: flex;
			align-items: center;
			justify-content: space-between;
		}

		&.noline {
			border-bottom: none;
			line-height: 2;
		}

		.huismalltext {
			color: #000000;
			opacity: 0.4;
			font-size: 24upx;
		}

		.redtext {
			font-size: 32upx;
			color: #FF3333;
		}

		&.huibg {
			background: #F8F8F8;
			opacity: 1;
			line-height: 2;
			padding: 20upx 30upx;
		}

		&.shouhuo {
			// background: url(/static/img25.png) left bottom no-repeat #F8F8F8;
			background: #F8F8F8;
			background-size: 100% auto;

			.shouh2 {
				opacity: 0.4;
			}

			.shouh3 {
				font-size: 32upx;
				color: #000000;
			}

			.shouh4 {
				font-size: 28upx;
			}

			.shouh5 {
				display: flex;
				align-items: center;

				// justify-content: space-between;
				.anniu {
					margin-left: 20rpx;
				}
			}
		}

		.ewm {
			width: 280rpx;
			height: 280rpx;
			border: 20rpx solid rgba(223, 104, 106, 0.10);
			border-radius: 20rpx;


		}

		.redwz {
			color: #DF686A;
		}
	}
</style>